﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Framework.Repository
{
    public class Paged<T> : List<T>
    {
        //public static Paged<T> Empty
        //{
        //    get
        //    {
        //        return new Paged<T>(0, 0, 0, Enumerable.Empty<T>());
        //    }
        //}

        public Paged(int totalCount, int pageSize, int currentPageIndex, IEnumerable<T> items)
        {
            //if (totalCount == 0)
            //{
            //    TotalCount = items.Count();//如果为0则从数据库里查询数量
            //}
            //else
            //{
            TotalCount = totalCount;
            //}

            PageSize = pageSize;
            CurrentPageIndex = currentPageIndex;

            base.AddRange(items);
        }

        public int TotalCount { get; private set; }

        public int PageSize { get; private set; }

        public int CurrentPageIndex { get; private set; }

    }
}